#ifndef _MODELRESOURCE_H
#define _MODELRESOURCE_H

#include "WEExternal.h"
#include "WEInterface.h"
#include "GraphicsDevice.h"
#include "BoundingSphere.h"

using namespace std;

using WuguiEngine::Math::BoundingSphere;

namespace WuguiEngine
{
	namespace Math
	{
		class BoundingSphere;
	}

	namespace Graphics
	{
		class GraphicsDevice;

		class ModelResource : IDisposed
		{
		public:
			ModelResource(string _filename, GraphicsDevice* device);
			virtual void Dispose();

			ID3DXMesh* GetD3DMesh();
			IDirect3DVertexBuffer9* GetVertexBuffer();
			IDirect3DIndexBuffer9* GetIndexBuffer();
			BoundingSphere* GetOriginalSphere();
		protected:
			void Initialize();
			void CalculateBoundingSphere();

			string filename;
			GraphicsDevice* pDevice;
			ID3DXMesh* pMesh;
			IDirect3DVertexBuffer9* pVertexBuffer;
			IDirect3DIndexBuffer9* pIndexBuffer;
			BoundingSphere* pOriginalSphere;
			DWORD FVF;
		};
	}
}
#endif